<template>
  <p-steps :current="current" :size="size">
    <p-step
      v-for="item in items"
      :key="item.scanType"
      :title="item.scanDesc"
    />
  </p-steps>
</template>

<script>
import { getAction } from '@/api/manage'
export default {
  props: {
    type: {
      type: String,
      required: true
    },
    stationCode: String,
    current: {
      type: Number,
      default: 0,
    },
    size: String,
    status: String,
  },
  data() {
    return {
      items: []
    }
  },
  watch: {
    type() {
      this.getData()
    },
    stationCode() {
      this.getData()
    }
  },
  created() {
    this.getData()
  },
  methods: {
    getData() {
      const { type, stationCode } = this
      if (!type || !stationCode) {
        return
      }
      const params = {
        type,
        stationCode
      }
      getAction('/basic-business/mfScanRuleSet/getScanRuleList', params).then(res => {
        this.items = res.data || []
        this.$emit('success', this.items)
      })
    }
  },
}
</script>
